###############################################
# XENOMORPH DIPLOMATIC ACTION - Hive Provocation (Q2)
#
# An aggressive, auto-accepted action available to a Xenomorph hive against
# any empire FROM WHICH it currently holds a captured leader. Parading the
# captive benefits the hive (influence + intel) and humiliates the target
# (opinion + trust loss), and fires an event pop-up on the target empire.
#
# ROOT = actor (the Xenomorph hive). FROM = recipient (target empire).
###############################################

action_xenomorph_parade_captive = {
	icon = "GFX_diplomacy_status_war"
	requires_recipient_independence = no
	requires_actor_independence = no
	auto_accepted = yes
	should_show_auto_accept_message_recipient = yes
	action_type = aggressive

	potential = {
		hidden_trigger = {
			# Only Xenomorph hives can do this.
			is_xenomorph_empire = yes
			from = { NOT = { is_country_type = mirrored_country } }
		}
	}

	possible = {
		custom_tooltip = {
			fail_text = "requires_held_captive_from_target"
			# Must currently hold a captured leader linked to the target empire.
			any_owned_leader = {
				has_leader_flag = xeno_captured_leader
				has_variable = xeno_origin_link
				from = { has_variable = xeno_origin_link }
				check_variable = {
					which = xeno_origin_link
					value = from.xeno_origin_link
				}
			}
		}
		custom_tooltip = {
			fail_text = "not_on_cooldown_parade_captive"
			NOT = { has_modifier = xeno_paraded_captive_recently }
		}
		custom_tooltip = {
			fail_text = "requires_not_at_war_with_target"
			NOT = { is_at_war_with = from }
		}
	}

	on_accept = {
		# --- Benefit to the hive: influence + intel on the target ---
		add_resource = { influence = 40 }
		from = {
			add_intel = {
				who = root
				amount = 60
			}
		}

		# --- Cooldown so it is not spammable (10 years) ---
		add_modifier = {
			modifier = xeno_paraded_captive_recently
			days = 3600
		}

		# --- Humiliate the target: opinion + trust loss ---
		from = {
			add_opinion_modifier = {
				who = root
				modifier = opinion_xenomorph_paraded_captive
			}
			add_trust = {
				amount = -15
				who = root
			}
			# Event pop-up on the target empire.
			country_event = {
				id = xeno_provoke.1
				days = 1
				scopes = {
					from = root
				}
			}
		}
	}
}
